package com.neutech.gui;

import com.neutech.constant.Constant;
import com.neutech.util.ImageUtil;

import java.awt.*;

public class GUI extends MyFrame{
    public GUI(String string) throws HeadlessException {
        super(string);
    }
    public  int x;
    public  int y;
    public double theate;


    public Image backgroundImage = ImageUtil.getImage("com/neutech/resource/sky01.jpg");
    public Image planetImage = ImageUtil.getImage("com/neutech/resource/04earth.png");
    @Override
    public void paint(Graphics g) {
        //画背景图
        g.drawImage(backgroundImage,Constant.CONSTANT_BACKGROUND_X,Constant.CONSTANT_BACKGROUND_Y, Constant.CONSTANT_WIDTH, Constant.CONSTANT_HEIGHT, null);
        //画行星
        g.drawImage(planetImage, this.x, this.y,
                Constant.CONSTANT_PLANET_WIDTH, Constant.CONSTANT_PLANET_HEIGHT, null);

        this.x = (int)((Constant.A + Constant.B * theate) * Math.cos(theate) + Constant.CONSTANT_WIDTH / 2);
        this.y = (int)((Constant.A + Constant.B * theate) * Math.sin(theate) + Constant.CONSTANT_HEIGHT / 2);
        theate += Constant.SPEED;
    }


}
